<?php

// we will show how to use CachedTemplate as well as how to use "blocks" in the templates


require_once("../Blueprint.php");

$array = array('zero', 'one', 'two');
array_splice($array, 1, 0, array('new'));
//var_dump($array);

// I'm creating a cachedTemplate for the header section because I know that it won't change too often
// the first param is the file, the second is a unique name to identify the cache (this can be a variable if I want instead of hardcoded)
// the third parameter is how often to refresh the cache (right now it's 1 hour)
$head = new Blueprint('header.html', 'testPage');

if (!$head->isCached()) {
	// the cache is not created or is not current
	// do all of your heavy database stuff here etc.
	$head->assign('pageTitle', 'My Test Page');
}
// if it is cached, we just saved ourselves a bunch (potentially) of database work
// and enabled our site to run faster with higher loads because of the cache

$template = new Blueprint('test.html');

// header is a block from another template
$template->assign('header', $head->fetch());
$template->assign('name', 'David');
$template->assign('colors', array('Black', 'Orange', 'Yellow'));

$template->display();

?>